home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power Programmierung
/
Power-Programmierung (Tewi)(1994).iso
/
magazine
/
dbms_mag
/
9107
/
olympia2
< prev
next >
Wrap
Text File
|
1991-05-20
|
2KB
|
108 lines
***************************************************************
* Program: Cdir.prg
* Author : P.L. Olympia, Platinum Software International
* Purpose: Demonstrates use of DOS and file functions from the
* : Jeff Davis Library. Program shows a graphical directory
* : tree and changes the default directory to the one
* : selected by the user.
* Syntax : C>Cdir
* Notes : From DBMS Set Expert On column, 07/91
***************************************************************
# include string.hdr
# include system.hdr
# include jdfil.hdr
# include jdio.hdr
# include jddos.hdr
DBFDEF Jddir
CHAR(12) DirName
CHAR(32) DirKey
UINT(3) LevelMax
ENDDEF
DBFDEF JDDIRPIC
CHAR(64) DirLine
ENDDEF
VARDEF
CHAR(30) DirFile = "Dirtree.Dbf"
CHAR(30) PicFile = "Dirpic.Dbf"
ENDDEF
PROCEDURE force_main
* PARAMETERS CHAR mpath
VARDEF
UINT level, winrec
CHAR mpath
CHAR(32) mkey
CHAR(64) selected_dir
LOGICAL mescape, ok
CHAR(8) ColorSay,ColorGet,ColorBord
ENDDEF
*-- Initialize vars
level = 0
mkey = SPACE(32)
winrec = 1
mpath = "D:\"
IF ISCOLOR()
ColorSay = "gr+/b"
ColorGet = "w+/rb"
ColorBord = "n"
Set Color to ColorSay,ColorGet,ColorBord
ENDIF
ok = .F.
REPEAT
CLEAR
GetAnswer("Enter drive/path:", 10, mpath, mescape, ;
.T., .F., 0, 0, 32)
mpath = RTRIM(mpath)
@ 20, 0
IF LEN(mpath) = 0
QUIT
ENDIF
IF SUBSTR(mpath,2,1) <> ":"
? "Path/Directory should be in the form D:\path\"
WAIT
ELSE
IF .NOT. ISDRIVE(SUBSTR(mpath, 1, 1))
? "Valid drive letters are: ", DRIVESTR()
WAIT
ELSE
ok = .T.
ENDIF
ENDIF
UNTIL ok
IF RIGHT(mpath, 1) <> "\"
mpath = mpath + "\"
ENDIF
mpath = mpath + "*.*"
FindAllDir(level, mpath, mkey, dirfile) && creates dirfile
MakeDirPic(dirfile, picfile, mpath)
selected_dir = PicDir(picfile, 0, 0, 20, 35, winrec, mpath)
selected_dir = RTRIM(selected_dir)
@ 23, 0
IF .NOT. SETDRIVE(SUBSTR(selected_dir, 1, 1))
? "Cannot change default drive"
QUIT
ENDIF
IF .NOT. CHDIR(selected_dir)
? "Cannot change to directory/path: ", selected_dir
ENDIF
ENDPRO
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=